package com.wq.httpclientcore.entities.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;

import com.wq.httpclientcore.handle.MapTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * @author wangqi
 * @since 2025-03-13 10:46:59
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName(value = "auth_config", autoResultMap = true)
@Schema(description = "鉴权配置")
public class AuthConfig implements Serializable {

    @TableId("id")
    @Schema(description = "记录的唯一标识符，自增主键")
    private Long id;

    @TableField("name")
    @Schema(description = "认证配置的名称，用于标识该配置")
    private String name;

    @TableField("auth_url")
    @Schema(description = "认证请求的目标 URL")
    private String authUrl;

    @TableField("auth_method")
    @Schema(description = "认证请求使用的 HTTP 方法，如 GET、POST 等")
    private String authMethod;

    @TableField(value = "auth_request_params",typeHandler = MapTypeHandler.class)
    @Schema(description = "认证请求的查询参数，以 JSONB 格式存储")
    private Map<String, Object> authRequestParams;

    @TableField(value = "auth_request_headers",typeHandler = MapTypeHandler.class)
    @Schema(description = "认证请求的 HTTP 头信息，以 JSONB 格式存储")
    private Map<String, Object> authRequestHeaders;

    @TableField(value = "auth_request_body",typeHandler = MapTypeHandler.class)
    @Schema(description = "认证请求的请求体，以 JSONB 格式存储")
    private Map<String, Object> authRequestBody;

    @TableField("auth_response_mapping")
    @Schema(description = "认证响应的映射规则，以文本形式存储")
    private String authResponseMapping;

    @TableField("auth_header_mapping")
    @Schema(description = "认证头信息的映射规则，以文本形式存储")
    private String authHeaderMapping;

    @TableField("created_at")
    @Schema(description = "记录的创建时间，默认值为当前时间")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    @Schema(description = "记录的更新时间，默认值为当前时间")
    private LocalDateTime updatedAt;


}
